package hy.threadLocal;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

public class Test {
    public static void main(String[] args) {
        Dog d1 = new Dog();
        new Thread("线程一"){
            @Override
            public void run() {
                try {
                    d1.f=new FileInputStream("5.txt");
                    d1.t1.set(new FileInputStream("d:/1.txt"));
                    d1.t2.set(new FileInputStream("d:/2.txt"));
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
                d1.t1.get();
                d1.t2.get();
            }
        }.start();

        new Thread("线程二"){
            @Override
            public void run() {
                try {
                    d1.f = null;
                    d1.t1.set(new FileInputStream("d:/3.txt"));
                    d1.t2.set(new FileInputStream("d:/4.txt"));
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
                d1.t1.get();
            }
        }.start();
    }
}
